using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using Entities;
using DAL;
namespace BUS
{
   public  class tbHinhThucTTBUS
    {
        public static void Insert(tbHinhThucTT hinhthuctt)
        {
            tbHinhThucTTDAL hinhthucttDAL = new tbHinhThucTTDAL();
            hinhthucttDAL.Insert(hinhthuctt);
        }
        public static void Update(tbHinhThucTT hinhthuctt)
        {
            tbHinhThucTTDAL hinhthucttDAL = new tbHinhThucTTDAL();
            hinhthucttDAL.Update(hinhthuctt);
        }

        public static void Detele(int iD)
        {
            tbHinhThucTTDAL hinhthucttDAL = new tbHinhThucTTDAL();
            hinhthucttDAL.Delete(iD);
        }

        public static tbHinhThucTTCollection Get(string where, int pageIndex, int pageSize, string orderBy, string orderDirection, out int total)
        {
            tbHinhThucTTDAL hinhthucttDAL = new tbHinhThucTTDAL();
            return hinhthucttDAL.Get(where, pageIndex, pageSize, orderBy, orderDirection, out total);
        }


        public static tbHinhThucTTCollection GetAll()
        {
            int total = 0;
            tbHinhThucTTDAL hinhthucttDAL = new tbHinhThucTTDAL();
            return hinhthucttDAL.Get("where 1=1", 0, 0, tbHinhThucTTColumns.IdHinhThuc.ToString(), "ASC", out total);
        }

        public static tbHinhThucTT GetById(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbHinhThucTTColumns.IdHinhThuc.ToString(), Condition.EQUAL, iD);
            tbHinhThucTTDAL hinhthucttDAL = new tbHinhThucTTDAL();
            tbHinhThucTTCollection hinhthucttCollection = hinhthucttDAL .Get(cri .Criter ,0,0,
                                                          tbHinhThucTTColumns .IdHinhThuc .ToString (),
                                                          OrderDirection .ASC .ToString (),out total );
            if (hinhthucttCollection.Count > 0)
                return hinhthucttCollection[0];
            return null;
        }
    }
}
